﻿using AppService.IService.Basic_information;
using Domain.Entity.Basic_information;
using Domain.IRepository.Basic_information;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;

namespace AppService.Service.Basic_information
{
    [Dependency(ServiceLifetime.Scoped)]
    public class VehiclesService : IVehiclesService
    {

        public IVehiclesRepository vehicles { get; set; }

        public VehiclesService(IVehiclesRepository vehicles)
        {
            this.vehicles = vehicles;
        }

        public List<Vehicles_ment> GetVehicles(int currentPage, int pageSize, string? date1, string? date2, string? value2)
        {
            return vehicles.GetVehicles(date1, date2, value2).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
        }

        public int GetCount(string date1, string date2, string value2)
        {
            return vehicles.GetCount(date1, date2, value2);
        }

        public bool DelVehicles(int id)
        {
            return vehicles.DelVehicles(id) > 0;
        }

        public bool AddVehicles(Vehicles_ment vehicle)
        {
            return vehicles.AddVehicles(vehicle) > 0;
        }

        public Vehicles_ment GetVehicles(int id)
        {
            return vehicles.GetById(id);
        }

        public bool UpdVehicles(Vehicles_ment vehicle)
        {
            return vehicles.UpdVehicles(vehicle) > 0;
        }
    }
}
